<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/static/js/common.js"/>"></script>
<script>
	function initList(listDisplayEId) {
		$('#' + listDisplayEId)
				.datagrid(
						{
							url : "<c:url value="/account/accountListForCustDetailForOrder.do"/>"
									+ "?custId="
									+ "${accountDayVo.custId }"
									+ "&ordDate=" + "${accountDayVo.ordDate }",
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							onLoadError : function() {
								$.messager.alert('错误', '获取数据失败，请与管理员联系！',
										'error');
							}

						});
	};
	function initList2(listDisplayEId) {
		$('#' + listDisplayEId)
				.datagrid(
						{
							url : "<c:url value="/account/accountListForCustDetailForStoreOut.do"/>"
									+ "?custId="
									+ "${accountDayVo.custId }"
									+ "&ordDate=" + "${accountDayVo.ordDate }",
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							onLoadError : function() {
								$.messager.alert('错误', '获取数据失败，请与管理员联系！',
										'error');
							}

						});
	};
	function initList3(listDisplayEId) {
		$('#' + listDisplayEId)
				.datagrid(
						{
							url : "<c:url value="/turnover/listTurnoverListForCust.do"/>"
									+ "?custId="
									+ "${accountDayVo.custId }"
									+ "&turnoverDate="
									+ "${accountDayVo.ordDate }",
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							onLoadError : function() {
								$.messager.alert('错误', '获取数据失败，请与管理员联系！',
										'error');
							}

						});
	};

	$(document).ready(function() {
		initList('listDisplay');
		initList2('listDisplay2');
		initList3('listDisplay3');
	});
	// 颜色
	function cellStyler(value, row, index) {
		if (row['returnGoods'] == 1) {
			return 'background-color:red;';
		}
	}
	// 种类格式
	var turnoverTypeClass;
	$.ajax({
		async : false,
		url : "<c:url value='/turnover/turnoverTypePullDown.do?space=0'/>",
		type : "post",
		data : {
			turnoverType : 1
		},
		success : function(data) {
			turnoverTypeClass = data;
			if (typeof (turnoverTypeClass) == 'string') {
				turnoverTypeClass = JSON.parse(turnoverTypeClass);
			}
		}
	});
	//设置种类
	function formatTurnoverType(value, row, index, field) {
		for (var i = 0; i < turnoverTypeClass.length; i++) {
			if (value == turnoverTypeClass[i].turnoverType) {
				return turnoverTypeClass[i].turnoverTypeName;
			}
		}
		return "无";
	}
</script>
</head>
<body>
	<table width="98%">
		<tr>
			<td>
				<div
					style="height: auto; width: 1180px; background: #fafafa; padding: 5px;"
					class="easyui-panel" title="基本信息" iconCls="icon-search"
					collapsible="true" minimizable="false" maximizable="false"
					closable="false">
					<form id="searchForm" name="searchForm" method="post">
						<div>
							<table cellpadding="5">
								<tr>
									<td>客户名：</td>
									<td><input class="easyui-validatebox" id="custName"
										editable="true" name="custName" readOnly="true"
										value="${accountDayVo.custName }"></input></td>
									<td>日期：</td>
									<td><input class="easyui-validatebox" id="ordDate"
										editable="true" name="ordDate" readOnly="true"
										value="${accountDayVo.ordDate }"></input></td>
									<td>收入合计：</td>
                                    <td><input class="easyui-validatebox" id="turnValueAll"
                                        editable="true" name="turnValueAll" readOnly="true"
                                        value="${accountDayVo.turnValueAll }"></input></td>
                                    <td>成本合计：</td>
                                    <td><input class="easyui-validatebox" id="costValueAll"
                                        editable="true" name="costValueAll" readOnly="true"
                                        value="${accountDayVo.costValueAll }"></input></td>
                                    <td>毛利率：</td>
                                    <td><input class="easyui-validatebox" id="grossProfitRate"
                                        editable="true" name="grossProfitRate" readOnly="true"
                                        value="${accountDayVo.grossProfitRate }%"></input></td>
								</tr>
								<input class="easyui-validatebox" id="custID" editable="true"
									name="custId" value="${accountDayVo.custId }" type="hidden"></input>
							</table>
						</div>
					</form>
				</div>
			</td>
		</tr>
		<tr>
			<td>
				<table id="listDisplay" title="采购成本列表" iconCls="icon-list"
					singleSelect="true" idField="turnoverId" loadMsg="请稍候......"
					pagination="true" pageSize="20" pageList="[10,20,30,40,50]"
					rownumbers="true" sortOrder="asc">
					<thead>
						<tr>
							<th field="id" width="80" sortable="true" editor="text"
								hidden="true">ID</th>
							<th field="ordId" width="80" sortable="true">订单id</th>
							<th field="custId" width="50" sortable="true">客户Id</th>
							<th field="custName" width="120" sortable="true">客户名</th>
							<th field="supId" width="80" sortable="true">供货商Id</th>
							<th field="supName" width="80" sortable="true">供货商名</th>
							<th field="ordDate" width="80" sortable="true">送货日期</th>
							<th field="materId" width="80" sortable="true">材料Id</th>
							<th field="materName" width="80" sortable="true">材料名</th>
							<th field="specifications" width="80" sortable="true">规格</th>
							<th field="brands" width="80" sortable="true">品牌</th>
							<th field="materWeight" width="50" sortable="true">数量</th>
							<th field="unit" width="40" sortable="true">单位</th>
							<th field="materValue" width="80" sortable="true">实际价钱</th>
							<th field="returnGoods" width="80" sortable="true"
								formatter="formaterReturnGoods" styler="cellStyler">退货标志</th>
						</tr>
					</thead>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table id="listDisplay2" title="出库详细列表" iconCls="icon-list"
					singleSelect="true" idField="storeOutId" loadMsg="请稍候......"
					pagination="true" pageSize="20" pageList="[10,20,30,40,50]"
					sortName="storeOutId" rownumbers="true" sortOrder="asc">
					<thead>
						<tr>
							<th field="id" width="80" sortable="true" editor="text"
								hidden="true">ID</th>
							<th field="storeOutId" width="80" sortable="true" editor="text">出库单号</th>
							<th field="materId" width="80" sortable="true" editor="text">材料id</th>
							<th field="materName" width="80" sortable="true" editor="text">材料名</th>
							<th field="materNumForOut" width="100" sortable="true"
								editor="text">出库数量</th>
							<th field="materValueForOut" width="100" sortable="true"
								editor="text">出库单价</th>
							<th field="materValueAllForOut" width="100" sortable="true"
								editor="text">数量总价</th>
							<th field="remark" width="200" sortable="true" editor="text">用途</th>
						</tr>
					</thead>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table id="listDisplay3" title="营业额列表" iconCls="icon-list"
					singleSelect="true" idField="turnoverId" loadMsg="请稍候......"
					pagination="true" pageSize="20" pageList="[10,20,30,40,50]"
					rownumbers="true" sortOrder="asc">
					<thead>
						<tr>
							<th field="id" width="25" align="center" checkbox="true"></th>
							<th field="turnoverId" width="80" sortable="true">ID</th>
							<th field="custId" width="80" sortable="true">客户ID</th>
							<th field="custName" width="80" sortable="true">客户名</th>
							<th field="turnoverType" width="100" sortable="true"
								formatter="formatTurnoverType">类型</th>
							<th field="turnoverValue" width="100" sortable="true">营业额</th>
							<th field="turnoverState" width="80" sortable="true"
								formatter="formaterTurnoverState">状态</th>
							<th field="turnoverDate" width="80" sortable="true">日期</th>
						</tr>
					</thead>
				</table>
			</td>
	</table>
</body>
</html>